package net.yegong;

import java.util.concurrent.LinkedBlockingQueue;

public class Logger {
	public static void log(String str, Object... obj) {
		try {
			queue.put(String.format(str, obj));
		}
		catch (InterruptedException e) {
			e.printStackTrace();
		}
	}

	public static String getMessage() {
		try {
			return queue.take();
		}
		catch (InterruptedException e) {
			e.printStackTrace();
		}
		return null;
	}

	private static LinkedBlockingQueue<String> queue = new LinkedBlockingQueue<String>();
}
